<?php
/**
 * +----------------------------------------------------------------------
 * | Author: 罗极
 * +----------------------------------------------------------------------
 * | Description: NormalRegister.php
 * +----------------------------------------------------------------------
 * | User: Administrator Date: 8/24/ 0024 Time: 15:29
 * +----------------------------------------------------------------------
 */

namespace Framework\Register;


use Framework\Register\Abstracts\BaseRegisterAbstracts;

/**
 * 全局变量存储Hash表
 * Class Register
 * @package Framework\Register
 */
class Register extends BaseRegisterAbstracts
{


    protected static $_self;
    protected function __construct(){}
    protected function __clone(){}

    public static function getInstance()
    {
        if(!is_object(self::$_self)) {
            self::$_self = new self();
        }

        return self::$_self;
    }

    public static $hashTable = [];

    public static function set($key, $val)
    {
        self::$hashTable[self::parserKey($key)] = $val;
    }

    public static function get($key)
    {
        return self::$hashTable[self::parserKey($key)];
    }

    public static function del($key)
    {
        unset(self::$hashTable[self::parserKey($key)]);
    }

    public static function clean($key)
    {
        self::$hashTable = [];
    }

}